package com.kly.manager.websocket.enums;

import lombok.Getter;

@Getter
public enum UserChatMessageTypeEnum {

    INFO("发送通知", "INFO"),
    ERROR("发送错误", "ERROR"),
    SEND_MESSAGE("发送消息", "SEND_MESSAGE");

    private final String text;
    private final String value;

    UserChatMessageTypeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static UserChatMessageTypeEnum getEnumByValue(String value) {
        if (value == null || value.isEmpty()) {
            return null;
        }
        for (UserChatMessageTypeEnum typeEnum : UserChatMessageTypeEnum.values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum;
            }
        }
        return null;
    }
}
